﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Marmat.Common.Http;

namespace 测试项目
{
    class JsonResultFilterAttribute : Marmat.Common.Http.JsonResultFilterAttribute
    {
        public override void OnResultExecuting(ApiActionContext context)
        {
            string resultstring;
            Encoding encoding = new UTF8Encoding();
            using (System.IO.Stream resStream = context.Response.GetResponseStream())
            {
                System.IO.StreamReader reader = new System.IO.StreamReader(resStream, encoding);
                resultstring = reader.ReadToEnd();
                reader.Close();
                resStream.Close();
            }
            context.ReturnValue = Newtonsoft.Json.JsonConvert.DeserializeObject(resultstring, context.ActionDescriptor.ReturnType);
        }
    }
}
